package com.lt73.springplugin.autowired;

import com.lt73.springplugin.autowired.service.PersonService;
import com.lt73.springplugin.autowired.service.PersonService2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

/**
 * @Author: hanxiao
 * @Date: 2022/3/18 17:53
 */
@SpringBootApplication
public class AutowiredApplication {
    public static void main1(String[] args) {
        SpringApplication springApplication = new SpringApplication(AutowiredApplication.class);
        ApplicationContext context = springApplication.run(args);
        PersonService service = context.getBean(PersonService.class);
        service.echo();
    }


    // 使用map注入完成策略模式
    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(AutowiredApplication.class);
        ApplicationContext context = springApplication.run(args);
        PersonService2 service = context.getBean(PersonService2.class);
        service.work("teacher");
    }
}
